<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Base\Annotation\Common;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/**
 * @ApiResource()
 * @ODM\Document(repositoryClass="App\Repository\MoneyLogTypeRepository")
 */
class MoneyLogType
{
    /**
     * @Common(cnName="#",editType="text",listType="text")
     * @ODM\Id(strategy="INCREMENT")
     * @Groups({"app"})
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     * @Groups({"money"})
     */
    private $id;

    /**
     * @Common(cnName="名称",editType="text",listType="text")
     * @ODM\Field( nullable=true)
     * @Groups({"app"})
     * @ORM\Column(type="string", length=255)
     * @Groups({"money"})
     */
    private $name;

    /**
     * @Common(cnName="编码",editType="text",listType="text")
     * @ODM\Field(type="raw" ,nullable=true)
     * @Groups({"app"})
     * @ORM\Column(type="integer")
     * @Groups({"money"})
     */
    private $code;

    public function __construct()
    {}

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getCode(): ?int
    {
        return $this->code;
    }

    public function setCode(int $code): self
    {
        $this->code = $code;

        return $this;
    }
}
